Link to home
Start Free TrialLog in
Avatar of runnerjp
runnerjp

asked on

clicking a button to enter website

basicly i want to do this...

by clicking a button a window pops up where i can enter a webaddress... once done click on and it adds it to my txtbox.. currently using just a button
<input type='button' value='Email' name='btnImg' onclick='wrapText(document.getElementById(&#39;inputforum&#39;),&#39;[email]&#39;,&#39;[/email]&#39;);'>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of fourice
fourice
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tomarse111
Please see below for what i think your after:
// This would be your initial page. Click the button and the popup opens with a text box and button to add your web address
<body>
    <form name="OrigForm">
        <input type='button' value='Email' name='btnImg' onclick='window.open("popup.htm","popup","width=200,height=50")'>
        <input type="text" id="WebAddress" name="WebAddress">
    </form>
</body>
 
//This would be the content of popup.htm. This allows a user to add a webaddress, click the button and the address is written back to the main page and the popup closes.
<script>
	function AddAddress(){
		window.opener.document.getElementById('WebAddress').value=document.getElementById('myWebAddress').value;
		window.close();
	}
</script>
<body>
<form name="myForm">
    	Enter Webaddress: <input type="text" id="myWebAddress" name="myWebAddress"> <input type="button" value="Add" onClick="AddAddress();">
    </form>
</body>

Open in new window

Avatar of runnerjp
runnerjp

ASKER

ok i tried the code below form fourice but it wont inset into my textbox and i also want the outcome to be [url] address [/url]
<script>
        function getAddress()
        {
                var anAddress = prompt("Address", "Type an address here");
                document.getElementById('inputforum').value=anAddress;
        }
</script>
<input type="button" onclick="getAddress()" value="Ask"></div>
 
					  <input name="title" type="hidden" value="<?php echo $gettopic3['title'];?>" />
				      <textarea id="inputforum" class="inputforum" name='yourpost' rows='5' cols='40'><?php if(isset($_POST['quote'])) {
                        $quote= $_POST['quote'];
						   $query = "SELECT * FROM forumtutorial_posts where postid=$quote"; 
if ($result = mysql_query($query)){
    if (mysql_num_rows($result)) {
        $array = mysql_fetch_assoc($result);}
      
?>
[quote] Originally Posted by:<strong><?php echo $array['author'];?></strong>
<br><?
echo $array['post']; echo '[/quote]';}}?> </textarea>

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@Tomarse111: no worries, we just want to help out someone else.
I hope it works for you runnerjp.
that works great guys... i will be awarding u both :D