Dashboard not running Javascript

Discussion in 'Mac Programming' started by svenr, Jul 9, 2007.

  1. macrumors regular

    #1
    Hi,

    I'd like to write a widget that shows a text input field and four buttons. When clicked, each button sends the string to a different URL via GET and opens that URL in a new browser window - essentially 4 diferent Submit buttons for the same form. When hitting Return after typing the text, it should default to the first URL.

    My script to create the four submit buttons works fine as a page in Safari, but does nothing in Dashboard. I click the buttons and nothing happens. Any idea what I'm doing wrong?

    Thanks!

    Code:
    <html>
    <head>
    <script language = "javascript">
    function setcount(target){
    	if(target == 0) document.search.action="http://www.domain.com/dir1";
    	if(target == 1) document.search.action="http://sub.domain.com/dir2";
    	if(target == 2) document.search.action="http://www.domain.com/dir3";
    	if(target == 3) document.search.action="http://www.domain.com/dir4"; 
    	document.search.submit();
     }
    </script>
    </head>
    
    <body>
    
    <input type="image" onclick="setcount(0)" 
    name="submit1" src="images/1.png">
    <input type="image" onclick="setcount(1)" 
    name="submit2" src="images/2.png">
    <input type="image" onclick="setcount(2)" 
    name="submit3" src="images/3.png">
    <input type="image" onclick="setcount(3)" 
    name="submit4" src="images/4.png">
    
    <form method="get" name="search" action="http://www.domain.com/dir1">
    	<input type="text" name="q" size="24">
    </form>
    
    </body>
    </html>
     
  2. macrumors regular

    #2
    Okay, so if no one here knows an answer, does someone know of another forum for Dashboard developers? Apple doesn't seem to have any. Where else could I get help with this?
     

Share This Page