Jump to content

otester

Members
  • Posts

    55
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

otester's Achievements

Member

Member (2/5)

0

Reputation

  1. I managed to get it pass on variables using the alert function to test, but how do you tell what font to use (this example doesn't work unfortunately)? <html> <head> <title></title> <script language="JavaScript"> var x; function Init() { iView.document.designMode = 'On'; } function bold() { iView.document.execCommand('bold', false, null); } function italic() { iView.document.execCommand('italic', false, null); } function underline() { iView.document.execCommand('underline', false, null); } function font(x) { if(x == 1) { iView.document.execCommand('fontname', false, Arial); //alert("Test"); } } </script> <body onLoad="Init()"> <FORM ACTION="#" NAME="font2"> <input type="button" onClick="bold()" value="B"> <input type="button" onClick="italic()" value="I"> <input type="button" onClick="underline()" value="U"> <select name="fontChanger" onChange="font(1)"> <option value="Arial">Arial</option> <option value="Tahoma">Tahoma</option> </select> </FORM> <br /> <iframe id="iView" style="margin-top: 20px; width: 200px; height:70px"></iframe> <br><br> </body> </html>
  2. This is what I currently have as a test, alert doesn't show <html> <head> <title></title> <script language="JavaScript"> function Init() { iView.document.designMode = 'On'; } function bold() { iView.document.execCommand('bold', false, null); } function italic() { iView.document.execCommand('italic', false, null); } function underline() { iView.document.execCommand('underline', false, null); } function font(fontname) { if(fontname == Arial) { //iView.document.execCommand('fontname', false, fontname); alert("Arial!"); } if(fontname == Tahoma) { //iView.document.execCommand('fontname', false, fontname); alert("Arial!"); } } </script> <body onLoad="Init()"> <FORM ACTION="#" NAME="font2"> <input type="button" onClick="bold()" value="B"> <input type="button" onClick="italic()" value="I"> <input type="button" onClick="underline()" value="U"> <select name="fontChanger" onChange="font(document.font2.fontChanger.value)"> <option value="Arial">Arial</option> <option value="Tahoma">Tahoma</option> </select> </FORM> <br /> <iframe id="iView" style="margin-top: 20px; width: 200px; height:70px"></iframe> <br><br> </body> </html>
  3. I tried this but I don't think it's right: <html> <head> <title></title> <script language="JavaScript"> function Init() { iView.document.designMode = 'On'; } function bold() { iView.document.execCommand('bold', false, null); } function italic() { iView.document.execCommand('italic', false, null); } function underline() { iView.document.execCommand('underline', false, null); } function font() { iView.document.execCommand('fontname', false, null); } </script> <body onLoad="Init()"> <input type="button" onClick="bold()" value="B"> <input type="button" onClick="italic()" value="I"> <input type="button" onClick="underline()" value="U"> <input type="button" onClick="font()" value="Change Font"> <!--<select name="fontname" onChange="font(document.quest.fontChanger.value)"> <option value="Arial">Arial</option> <option value="Tahoma">Tahoma</option> </select>--> <br /> <iframe id="iView" style="margin-top: 20px; width: 200px; height:70px"></iframe> <br><br> </body> </html> Is there a way your meant to tell it which font?
  4. Here: <html> <head> <title></title> <script language="JavaScript"> function Init() { iView.document.designMode = 'On'; } function bold() { iView.document.execCommand('bold', false, null); } function italic() { iView.document.execCommand('italic', false, null); } function underline() { iView.document.execCommand('underline', false, null); } function font(fontname) { iView.document.execCommand(style.font-family:+fontname;, true, null); } </script> <body onLoad="Init()"> <input type="button" onClick="bold()" value="B"> <input type="button" onClick="italic()" value="I"> <input type="button" onClick="underline()" value="U"> <select name="fontChanger" onChange="font(document.quest.fontChanger.value)"> <option value="Arial">Arial</option> <option value="Tahoma">Tahoma</option> </select> <br /> <iframe id="iView" style="margin-top: 20px; width: 200px; height:70px"></iframe> <br><br> </body> </html>
  5. How do you get the execCommand to change the style of text? Currently have a drop down box and used Google but can't find anything on the subject Any ideas? Thanks, otester
  6. How can I implement a word processor into my website which manipulates text in real-time (font size, colour, bold/italics etc.). Any help would be great! Thanks, otester
  7. Also this needs to be in PHP as other script rely on it.
  8. I have a PHP random number generator, however this requires page loads to generate another number. If I put the PHP code in a script file, how can I get a button to refresh/update it with an jQuery/Ajax http request? PHP code: <?php $app_ran = Rand(1,6); echo $app_ran; Any help would be great, Thanks, otester
  9. Works now! Thank you very much and to everyone else who posted!
  10. Is there a way to add a unique div ID for each result?
  11. The button doesn't do anything visually. Btw I don't mean delete from the database I mean just off the screen, basically my web page just lists stuff and users can either choose to keep an item, delete or replace it with another random one.
  12. How do I extract each of the results from the array though? My goal is to be able to list results a delete individual results on the page with jQuery if the user needs to and I was going to do this by putting each result between <div> tags.
  13. My current code lists between 1-6 results from a MySQL array. How do I extract the data from the list and put it into its own variable (eg: $result1, $result2 etc.) ? $ran_x = rand(1,6); $ran_x = rand(1,6); $x_query = "SELECT * FROM `x` ORDER BY RAND( ) LIMIT $ran_x"; $get_x = mysql_query($appearance_query); echo 'x(s): '; echo '<br />'; while($row = mysql_fetch_array($get_x)) { echo $row['Appearance']; } Any help would be great, Thanks, otester
  14. Currently my code picks a random number between 1-6 then extracts that many (random) entries from a list in my database. My current code displays the whole array, how can I chop the array into 6 bits so I can output the data separately (up to 6 list items)? $con = mysql_connect("x","x","x"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("x", $con); $ran_x = rand(1,6); $appearance_query = "SELECT * FROM `x` ORDER BY RAND( ) LIMIT $ran_x"; $get_x = mysql_query($x_query); echo 'x(s): '; echo '<br />'; echo "<ul style='list-style:none;'>"; while($row = mysql_fetch_array($get_x)) { echo "<li>" . $row['x'] . "</li>"; } echo "</ul>"; echo "<br />"; mysql_close($con); Any help would be greatly appreciated, Thanks, otester
×
×
  • 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.