Re: JS prompt -> php [become 0T]

From: Date: Sat, 10 Feb 2007 13:37:33 +0000
Subject: Re: JS prompt -> php [become 0T]
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-248706@lists.php.net to get a copy of this message
Ryan A wrote: > Hey Colin, > Thanks for replying. > > I guess this has sidelined from php a bit now... so have added a OT in the subject line. > > Anyway, this is how I get the values from a select or a text box: > > var selectBox = document.forms[0].lang; user_input = > selectBox.options[selectBox.selectedIndex].value; > var textBox = document.forms[0].sec_name; user_section = textBox.value; > > kindly show me how to get the value from a javascript prompt box, > the force is with me but the JS DOM is from the dark side :D I think you just do 'var value = prompt("Give Me a Value:", "Value");' Also, it is generally more portable to give any element that you wish to access an id attribute in HTML and use the document.getElementById('myid') method. This is the preferred method (and infact libraries like prototype will give you even nicer functions like $('myid') to do this). PS this is is not yet touching on DOM methods ;) Col

« previous php.general (#248706) next »