Jump to content

textarea fetching


mattal999

Recommended Posts

Hi,

 

i have this script:

 

<html>
<head>
<title>File Editor</title>
</head>
<script language="JavaScript" type="text/javascript" src="wysiwyg.js">
</script>
<script>
function test()
{
var content = document.example.content.value;
document.getElementById("prev").innerHTML = "<a href='test.php?content=";
document.getElementById("prev2").innerHTML = "content";
document.getElementById("prev3").innerHTML = "' target='_blank'>";
}
</script>

<body>
<center><form name='example' method='POST' action='write.php?file=<? echo $file; ?>'>
<textarea id="content" name='content' style="height: 415; width: 700;" rows="1" cols="20"><? echo $content; ?></textarea>
<script language="javascript1.2">
  generate_wysiwyg('content');
</script><br>
<input type='image' border='0' src='buttons/button.bmp' name='submit'>
</form>
<p><div id='prev'><script>test();</script></div><div id='prev2'></div><div id='prev3'></div><img src='buttons/button2.bmp' border='0' onmouseover='javascript:test();'></a>
</body>
</html>

 

and i want it to dynamically change when the button is hovered over. However, even this doesn't work...

 

help please!

Link to comment
Share on other sites

i got this:

 

 
<html>
<head>
<title>File Editor</title>
</head>
<script language="JavaScript" type="text/javascript" src="wysiwyg.js">
</script>
<script>
function test()
{
var content = document.example.content.value;
var contentstring = '<a href='test.php?content=' + content + '' target='_blank'>';
document.getElementById("prev").innerHTML = "+contentstring+";
}
</script>

<body>
<center><form name='example' method='POST' action='write.php?file=hi2.php'>
<textarea id="content" name='content' style="height: 415; width: 700;" rows="1" cols="20"><P align=center>      <IMG alt="" src="http://www.games4uonline.com/drag/images/logo.png" border=0 alignment=""></P>
<P align=center><FONT face=Verdana size=2>Hello and welcome to Drag Racer 2!</FONT></P></textarea>
<script language="javascript1.2">
  generate_wysiwyg('content');
</script><br>
<input type='image' border='0' src='buttons/button.bmp' name='submit'>
</form>
<p><div id='prev'><script>test();</script></div><img src='buttons/button2.bmp' border='0' onmouseover='javascript:test();'></a>
</body>
</html>

 

but still no change...

Link to comment
Share on other sites

i also tried this and nothing happens:

 

<html>
<head>
<title>File Editor</title>
<script language="JavaScript" type="text/javascript" src="wysiwyg.js">
</script>
<script>
function test()
{
var content = document.example.content.value;
document.getElementById("prev").innerHTML = "" + "<a href='test.php?content="+content+"' target=_blank>";
}
</script>
</head>
<body>
<center><form name='example' method='POST' action='write.php?file=<? echo $file; ?>'>
<textarea id="content" name='content' style="height: 415; width: 700;" rows="1" cols="20"><? echo $content; ?></textarea>
<script language="javascript1.2">
  generate_wysiwyg('content');
</script><br>
<input type='image' border='0' src='buttons/button.bmp' name='submit'>
</form>
<p><div id='prev'><script>test();</script></div><img src='buttons/button2.bmp' border='0' onmouseover='javascript:test();'></a>
</body>
</html>

Link to comment
Share on other sites

works in ff

 

<html>
<head>
<title>File Editor</title>
<script language="JavaScript" type="text/javascript" src="wysiwyg.js">
</script>
<script>
function test()
{
var content = document.example.content.value;
document.getElementById("prev").innerHTML = "" + "<a href='test.php?content="+content+" target=_blank>";
}
</script>
</head>
<body>
<form name='example' method='POST' action='write.php?file=<? echo $file; ?>'>
<textarea id="content" name='content' style="height: 415; width: 700;" rows="1" cols="20"><? echo $content; ?></textarea>
<script language="javascript1.2">
  //generate_wysiwyg('content');
</script><br>
<input type='image' border='0' src='http://www.google.com/logos/pavarotti.gif' name='submit'>
</form>
<p><div id='prev'></div><img src='http://www.google.com/logos/pavarotti.gif' border='0' onmouseover='javascript:test();'></a>
</body>
</html>

Link to comment
Share on other sites

document.getElementById("prev").innerHTML = "" + "<a href='test.php?content="+content+" target=_blank>";

--you're innerHTML'ing incomplete html, you're missing the closing link tag:

document.getElementById("prev").innerHTML = "" + "<a href='test.php?content="+content+" target=_blank>" + 'testlink</a>';

--always innerHTML well formed html, properly nested with all closing tags, or many browsers will not render it (as well they shouldn't).

 

--you also shouldn't be putting the 'content' javascript variable on the url without url escaping it.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.