Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

javascript error

  • 21-05-2004 10:37am
    #1
    Registered Users, Registered Users 2 Posts: 9,281 ✭✭✭


    hey, I've an error on the following code:
    <html>
    <head>
    <title>testing javascript!</title>
    <script language=JavaScript>
    <!--
    function URL()
    {
    	var url=prompt("Enter the URL","http://");
    	var linkname=prompt("Enter the name","");
    
    	var current=document.test.display.value;
    
    	document.test.display.value=current+"<a href="+url+">"+linkname+"</a>";
    }
    function IMG()
    {
    	var url=prompt("Enter the URL","http://");
    
    	var current=document.test.display.value;
    	
    	document.test.display.value=current+"<img src="+url+">";
    }
    //-->
    </script>
    </head>
    <body>
    <form name=test>
    <input type=button value="URL" onclick="URL()">  //when run, this is the line with the error
    <input type=button value="IMG" onclick="IMG()"><br>
    <textarea cols=30 rows=10 name=display></textarea>
    </form>
    </body>
    </html>
    

    The URL function doesn't work, but strangely enough, the IMG one does and they're a variation on one another...

    Can anyone see something blatently obvious??? I'm better at debugging PHP than JavaScript :dunno:


Comments

  • Closed Accounts Posts: 1,651 ✭✭✭Enygma


    If you change the name of the URL() function to something like doUrl() it will work. This is because there's a URL object in Javascript.


  • Registered Users, Registered Users 2 Posts: 1,268 ✭✭✭hostyle


    URL() appears to be a reserved name. Try calling the function a different name.


  • Registered Users, Registered Users 2 Posts: 9,281 ✭✭✭RobertFoster


    cheers :D


Advertisement