Change font in JavaScript in html snippet

I would like a 'this website was last updated' and have found a script that seems to work in an html snippet in iweb but I can't work out how to change the font.  Also I don't want to incude the day of the week but am unsure how much to delete. I'm a novice so if someone could edit the code for me that would be marvellous!  I would like the font to be in Helvetica Neue in size 12.  Thank you
Here's the script
<script language="javascript">
months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
var d=new Date();
var weekday=new Array(7);
weekday[0]="Sunday";
weekday[1]="Monday";
weekday[2]="Tuesday";
weekday[3]="Wednesday";
weekday[4]="Thursday";
weekday[5]="Friday";
weekday[6]="Saturday";
var d = new Date();
(d.getFullYear());
var theDate = new Date(document.lastModified);
theDate.setTime((theDate.getTime()+(60*60)) )
with (theDate) {
document.write("<i>Last updated "+weekday[getDay()]+' '+getDate()+' '+months[getMonth()]+' '+d.getFullYear()+' '+getHours()+':'+getMinutes()+" GMT</i>")
</script>

Eureka!  I think I've finally done it.  With the help of all of you and combining & editing scripts I think I've achieved it.  It seems to be working anyway.  Perhaps you would have a look at it and see if there are any glaring errors!  Many thanks to you all... I understand it a little better now but I still couldn't have done it on my own.  Thanks again
<div style="width: 250px; height: 15px; margin-left: 0px; font-family: Helvetica Neue, Cochin, 'Helvetica Neue', Arial, sans-serif; font-size: 11px; color: #424242">
<script type="text/javascript">
<!--
var d_names = new Array("Sun", "Mon", "Tue",
"Wed", "Thu", "Fri", "Sat");
var m_names = new Array("Jan", "Feb", "Mar",
"Apr", "May", "Jun", "Jul", "Aug", "Sep",
"Oct", "Nov", "Dec");
var d = new Date(parent.document.lastModified);
var curr_day = d.getDay();
var curr_date = d.getDate();
var curr_hour = d.getHours();
var curr_min = d.getMinutes();
var sup = "";
if (curr_date == 1 || curr_date == 21 || curr_date ==31)
   sup = "st";
else if (curr_date == 2 || curr_date == 22)
   sup = "nd";
else if (curr_date == 3 || curr_date == 23)
   sup = "rd";
else
   sup = "th";
var curr_month = d.getMonth();
var curr_year = d.getFullYear();
var a_p = "";
if (curr_hour < 24)
   a_p = "GMT";
else
   a_p = "GMT";
if (curr_hour == 0)
   curr_hour = 24;
if (curr_hour > 24)
   curr_hour = curr_hour - 24;
if (curr_min < 10)
   curr_min = "0" + curr_min;
document.write("Site last updated:  " + d_names[curr_day] + " " + curr_date + " " + m_names[curr_month] + " " + curr_year + " at " + curr_hour + ":" + curr_min + " " + a_p);
//-->
</script>
</div>

Similar Messages

  • How to change appearance of text in HTML snippet?

    Does anyone know if / how I can make the text inside an HTML snippet (when rendered in the overall HTML page) appear like the text on the rest of the page?
    Here, you can see an example of what I mean: http://zach.in.tu-clausthal.de/tmp/iweb.png
    So, the HTML snippet contains, effectively, a hyperlink to an email adress - now I would like to make the email adress look like all other links on my web page.
    I have tried to insert a <span class=".."> inside the HTML snippet, to no avail.
    Any other ideas, suggestions, and insights will be highly appreciated.
    Regards,
    Gabriel.

    Normally you would just use a style for the <a> so that you can style the link and rollover.
    If you want to use this code as is, put the CSS into the snippet. You don't need a span "class".
    Change the span to this...
    <span>zach in.tu-claushal.de</span>
    ... and add the style...
    <style type="text/css">
    span {
        font: 1.0em "Verdana", sans-serif;
        font-style: normal;
        color: #000FFF;
        text-decoration: underline;
        text-transform: normal;
    </style>
    Change the font type, size and color to taste.
    I have expressed the size in ems but you can use pixels etc.
    If you don't want the underline, change "text-decoration" to "none".

  • Change font when replying a HTML messages

    I want to change the font when I reply an e-mail in HTML. The current font is big. A colleague of mine is able to reply using the same font the message was composed with his Android

    The only way to get an answer to this is if you post the URL to page in question.
    Or, you may be able to ascertain which selector you need to style using your browser's Inspect Elements tools.  To bring it up, right Click in Chrome or Firefox.
    Nancy O.

  • HTML Snippet Font

    Hello --
    I have an HTML snippet embedded on one of my iWeb pages that provides a list of events that have been entered on to a BigTent group. The page on BigTent that provided the code displayed what the snippet should look like, and the text was in a sans serif font (Arial or Helvetica) that would nicely blend in with the look of the site I am working on, however, when I actually pasted the snippet onto the iWeb page, it displayed in Times font. I have tried to add in a line of code to change the font, but it never does change. Here is the snippet (with no alterations):
    <script type="text/javascript"
    src="https://www.bigtent.com/hosted/sdhsa/calendar/upcoming?hosted_key=42742
    419ae77ecead0502edab9715469&nevents=5&days=90"></script>
    Any ideas on how I can get this to display in a specific font (in this case, helvetica)?
    Thanks!

    Enclose the JavaScript with a <span> and use a style
    <script type="text/javascript"
    src="https://www.bigtent.com/hosted/sdhsa/calendar/upcoming?hosted_key=42742
    419ae77ecead0502edab9715469&nevents=5&days=90"></script>
    http://htmlhelp.com/reference/css/font/

  • How do you change fonts in an HTML report?

    Hello all,
    I need to create a report from a test that I've written, and my only feasible option is HTML. Unfortunately, I know next to nothing about HTML, so I'm using the LabView VI's to build the report.
    In the attached VI, I've written a program that simply plops a couple lines of text down and saves it in the HTML format. The color, font style, font type all seem to work fine, and when I change them I see the changes reflected in the HTML document. The size, however, doesn't change.
    What I need to do is have the ability to have different lines of text be different sizes, or even 1 word in a sentence be a different size.
    How do I do this?
    What am I doing wrong?
    Any help would be greatly app
    reciated!
    Dave Neumann
    [email protected]
    Attachments:
    htmltrial.vi ‏78 KB
    111.html ‏1 KB

    Dear Dave,
    The setting of the size is working but your parameters are inadequate for a HTML document.
    The reporting VIs are generating HTML which is decrepated. It generates a FONT tag with a size attribute with "30pt" and "10pt" as you have set in the Set Report Font parameters. The HTML standard allows only values of "1" to "7". The standard works with relative sizes so a "pt" does not apply to it. "1" is the smallest size and the actual displayed size depends on the setting of the browser. In MS IE you can set it under View>>Size to one of five degrees.
    If you would use "5" and "7" instead of "10pt" and "30pt" you will see the text in different size.
    Your values are coerced to 7. That's why you see something you didn't expected.
    Unfortunatly
    I have no experience with the reporting VIs. I'm not sure if they can use the style sheet formatting which will allow font sizes measured in points.
    Waldemar
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions

  • How do I change the style of text in an HTML Snippet?

    Hello everyone,
    I'm using an HTML snippet with an iFrame tag in it. What formatting code do I include in the snippet so that the style of the text is the same as that of the default text object for the particular iWeb theme I'm using?
    Much obliged,
    Gregory

    Use CSS to format fonts. Look here for info.

  • Can i  change font  size  in  jasper  exported  Html  report

    how can i change font size in jasper exported Html report.
    i also want table in that html report.

    So when is it going to be possible, I ask, as this is a question I and many others ask after each update!

  • Changing Font in SlideShow Template

    Good morning,
    In creating an iWeb page I have chosen the Black>Photos theme. After clicking on one of the photos in my album I am taken to an enlargement of said photo with buttons from 'Back to Album', 'Previous' and 'Next'. I would like to change the font and color of these buttons. Is this possible?
    Thanks for you time,
    John

    Thanks you very much for your detailed help. It seems I will have a lot to learn before I attempt any of your 3 suggestions. What is a CSS file and how might I go about learning to make one?
    CSS controls style sheets on the page: http://www.w3.org/Style/CSS/
    Photos page CSS file is in your photosPage_files folder, but as I mentioned you need to know iweb widgets also.
    By default, photos page has three widget: header controls, detail view and footer controls widgets, but depend on if and how many other widgets such as nav bar, HTML Snippets... iweb build CSS files accordingly.
    CSS and iweb widgets (javascript) are difficult to understand, because of the abstract nature. A lot reading and asking questions, W3.org is a good place to start.

  • Html Snippet Code from BandsInTown not working...

    I have just installed a list of tour dates using BandsInTown App  linked with my
    facebook page here
    https://www.facebook.com/pages/Anna-Corcoran-Music/173909359323639
    And i have selected the box offering the code to embed the dates onto my
    website here at www.annacorcoran.com which is:
    <script type='text/javascript' src='
    http://www.bandsintown.com/javascripts/bit_widget.js'></script>
    <script type='text/javascript'>var widget = new BIT.Widget({"artist":"Anna
    Corcoran Music","prefix":"fbjs"});widget.insert_events();</script>
    But when I paste the code into the html snippet box in iweb just
    an empty box with a faint outline appears. Is this to do with needing to adjust the code for
    iweb?
    HELP!! Why isn't it working?!
    Anna

    Okay - last question where in the code below Can I change the colour of the text?
    <script type='text/javascript' src='http://www.bandsintown.com/javascripts/bit_widget.js'></script>
    <script type='text/javascript'>var widget = new BIT.Widget({"artist":"Anna Corcoran Music","prefix":"fbjs"});widget.insert_events();</script>
    Thanks

  • HTML Snippets not working for most browsers

    I have a page with a flash movie in the background, which uses the following code in an HTML snippet:
    <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#v ersion=6,0,40,0"
    WIDTH="602" HEIGHT="420" id="BGAnimation">
    <PARAM NAME=movie VALUE="BGAnimation">
    <PARAM NAME=quality VALUE=high>
    <PARAM NAME=base VALUE=".">
    <EMBED src="http://www.site.com/somefile" quality=high WIDTH="600" HEIGHT="420"
    NAME="BG Animation" ALIGN="" TYPE="application/x-shockwave-flash"
    PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" base=".">
    </EMBED>
    </OBJECT>
    On top of that, I have 3 other snippets, which are buttons, and are coded as follows:
    <script type="text/javascript">
    function mouseOver()
    {document.rolloverone.src="rolloverpicture.png"}
    function mouseOut(){
    document.rolloverone.src="offpicture.png"}
    </">
    Of course the locations and file names have been changed, because I can't actually show people the site yet. Anyhow, it all works fine on my computer, in both Safari and Firefox, but tests on Windows computers and older macs have not been successful. The buttons are behind the flash movie (therefore invisible), or they block out part of the Flash movie, depending on which browser is used.
    I should mention two more things: I have done tests where the buttons were placed off to the side of the flash movie, rather than on top of it, and the buttons looked and worked fine in all browsers.
    Also, the PNG files used for the buttons are partly transparent, so you should be able to see the Flash movie below them, even the part of it that falls inside the boundaries of the button.
    I have a feeling the whole "HTML Snippet" thing is not fully compatible, or they just don't like to be stacked on top of each other or something. Does anyone know how to fix this?
    Any help is greatly appreciated. My last million questions have all received helpful answers here. This is a great forum!
    Message was edited by: hum_bucker
    Message was edited by: hum_bucker
    Message was edited by: hum_bucker

    The following codes for mouse rollover effect that I use in this demo page, Mouse Rollover & Animated Gifs, work with Firefox 3.5, Opera and OmniWeb.
    <xmp>
    <blockquote style="padding-left: 50px;"><A HREF="URL to this page"
    onmouseover="document.sub_but.src='URL to rollover image"
    onmouseout="document.sub_but.src='URL to original image" >
    < IMG SRC="URL to original image" WIDTH="100" BORDER="0" ALT="Move your mouse over me" NAME="sub_but">
    < /A></blockquote>
    <blockquote style="padding-left: 50px;"><script type="text/javascript">
    function mouseOver()
    {document.rollover_one.src="URL to rollover image"}
    function mouseOut(){
    document.rollover_one.src="URL to original image"}
    </script>
    <a href="http://link.com">
    <img alt="Link Title" src="URL to original image"} name="rollover_one" width="100" height="" onmouseover="mouseOver()" onmouseout="mouseOut()" style="border: none;"/></a></blockquote>
    </xmp> *(Ignore the <xmp></xmp> tags when copying)*
    Can't help you with the flash movie.
    OT

  • Print this Page Java html snippet

    I decided to try adding the above to one of my pages in iWeb.
    I added the java code as shown on Old Toad's site:-
    <form>input type="button" value=" Print this Page "
    onclick="javascript:parent.window.print();return false;"/></form>
    I placed this code in an html snippet in iWeb and applied it and it showed up as Print this Page in the site. I then published the site to a local folder and uploaded the changed pages to my external server. After uploading, I visited my site and tried clicking on the button and it did not work.
    Anyone know why it did not work? The code is correct and I copied and pasted from OT's site directly into an html snippet.
    Is the code site or page specific or generic, that it will work for any site?
    Does it only work in MobileMe published sites and not for sites uploaded to an external server?
    Any insights gratefully received.

    Does the print button work when the site was on your HD locally? Here's some different code that you might try:
    <SCRIPT LANGUAGE="JavaScript">
    // This script was supplied free by Hypergurl // <a class="jive-link-external-small" href="http://www.hypergurl.com">http://www.hypergurl.com</a> <!--
    hide script and begin if (window.print) { document.write('<form>Click Here
    To ' + '<input type=button name=print value="Print" ' + 'onClick="javascript:window.print()">
    This Page!</form>'); } // End hide --> </script>
    The original code should work on any server as far as I know. Cyclosaurus is the authority on javascript and should have an answer.
    This Google search has numerous examples of code:http://www.google.com/search?hl=en&safe=active&client=safari&rls=en-us&ei=MBCjSd X6LoK2sQOIj8zGCQ&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=javascriptto+printpage&spell=1

  • Posterous blog HTML Snippet problem - not all of blog is showing up...

    Good morning all! So I was looking for a solution for our newly formed website (I'm a novice) where I could have multiple users update our blog page without having to use iWeb to do it. I read up on Posterous and it appears this would be an ideal solution. So I found some code from another Apple Discussions poster, Alancito, that would pull my Posterous blog directly into the iWeb page I created. Well it has done that, sort of...
    I see the header from the blog, but the content isn't visable. Well, actually if you highlight the header or "blog differently" and then hold down like you're scrolling down the page, the info is there. But the HTML snippet always cuts it off. Even if I expand the size of the snippet in iWeb, it ALWAYS reverts back to this same size.
    I'm in a bind here and could really use some help.
    Here's the blog page address: http://www.sporkfoodwagon.com/SporkFoodWagon/Blog.html
    And here's the code I was provided.
    <iframe height="100%" allow transparency="true" frameborder="0" scrolling="no" style="width:100%;border=none" src="http://sporkfoodwagon.posterous.com/"></iframe>
    Message was edited by: andrewrichardson

    Andrew ~ Perhaps someone will suggest a solution to the HTML Snippet problem, but meanwhile, with this recent improvement to Posterous:
    http://blog.posterous.com/posterous-unveils-pages
    ...perhaps you don't need an iWeb site at all. If you must have one, consider linking to your Posterous blog directly from iWeb's navigation bar:
    Create a blank internal page titled "Blog" (actually you can name the page whatever you want.) Then in that Blog page add an HTML Snippet with the following code:
    <script type="text/javascript">
    parent.window.location = "http://www.yourblogname.com"; // change this to your own URL
    </script>
    ...Once published, clicking on "Blog" in the navbar will immediately redirect to your external Blog page. (Thanks to Cyclosaurus for the code).
    And to return from Posterous back to your iWeb site:
    http://blog.posterous.com/pages-20-add-links-to-your-sidebar

  • HTML Snippet and Kryogenix SortTable

    Kryogenix has a great piece of Javascript code that will sort tables on screen by clicking the column heading. You can see it here.
    http://kryogenix.org/code/browser/sorttable/
    Does anyone know how to actually use that JavaScript code in iWeb using the 'HTML Snippet' feature?

    It's spelled out for you on the page you linked to.
    Not very difficult at all if you take the time to read the page.
    I was hoping I could avoid that!
    Honestly? It's naive to think that you can receive a custom feature without obtaining the knowledge to implement it. Somethings require a little bit of effort on the users' end. This is one of those things.
    If you don't want to learn code then simply create page 1 sorted 1 way and page 2 sorted the other way then link the head of page 1 to page 2 to create a "fake" sortable table similar to the NBA example you originally linked to. The NBA example is using MySQL and sorts the column based on a URL parameter to change the order by parameter in MySQL.
    I thought you were going the jQuery route anyway...

  • How do I change fonts in a Text field ??

    Okay I've tried to implement a JComboBox that allows the user to change fonts in the text field. So far I've tried different methods to do it but to no avail. Could somebodoy here read the programs source code for me and tell me where I went wrong?
    /* * My GUI Client */
    import javax.swing.*;
    import javax.swing.text.*;
    import java.awt.*;
    import javax.swing.event.*;
    //for HTML Headers
    import javax.swing.text.StyledEditorKit.*;
    import javax.swing.text.html.HTMLEditorKit.*;
    import javax.swing.text.html.*;
    import javax.swing.event.HyperlinkListener;
    import javax.swing.event.HyperlinkEvent;
    import javax.swing.event.HyperlinkEvent.EventType;
    import javax.swing.text.html.HTMLFrameHyperlinkEvent;
    //for layout managers
    import java.awt.event.*;
    //for action and window events
    import java.io.*;
    import java.net.*;
    import java.awt.GraphicsEnvironment;
    //for font settings
    import java.lang.Integer;
    import java.util.Vector;
    import java.awt.font.*;
    import java.awt.geom.*;
    public class guiClient extends JFrame implements ActionListener {
    protected static final String textFieldString = "JTextField";
    protected static final String loadgraphicString = "LoadGraphic";
    protected static final String connectString = "Connect";
    static JEditorPane editorPane;
    static JPanel layoutPanel = new JPanel(new BorderLayout());
    static JPanel controlPanel = new JPanel(new BorderLayout());
    static JPanel buttonPanel = new JPanel(new BorderLayout());
    static JPanel fontPanel = new JPanel(new BorderLayout());
    static PrintStream out;
    static DrawPanel dPanel;
    static DrawPanel dPButton;
    static DrawPanel dFonts;
    static DrawControls dControls;
    static DrawButtons dButtons;
    static String userString;
    static String currentFont;
    String fontchoice;
    String fontlist;
    static JTextField userName = new JTextField();
    public static JMenuBar menuBar;
    private static JButton connectbutton = new JButton("Connect");
    static boolean CONNECTFLAG = false;
    //create the gui interface
    public guiClient() {
         super("My Client");
    // Create a ComboBox
    GraphicsEnvironment gEnv = GraphicsEnvironment.getLocalGraphicsEnvironment();
    String envfonts[] = gEnv.getAvailableFontFamilyNames();
    Vector vector = new Vector();
    for ( int i = 1; i < envfonts.length; i++ ) {
    vector.addElement(envfonts);
    JComboBox fontlist = new JComboBox (envfonts);
         fontlist.setSelectedIndex(0);
         fontlist.setEditable(true);
         fontlist.addActionListener(this);
         fontchoice = envfonts[0];     
    //Create a regular text field.
         JTextField textField = new JTextField(10);
         textField.setActionCommand(textFieldString);
         textField.addActionListener(this);          
    //Create an editor pane.
    editorPane = new JEditorPane();
         editorPane.setContentType("text");
         editorPane.setEditable(false);
    //set up HTML editor kit
         HTMLDocument m_doc = new HTMLDocument();
         editorPane.setDocument(m_doc);
         HTMLEditorKit hkit = new HTMLEditorKit();
         editorPane.setEditorKit( hkit );
         editorPane.addHyperlinkListener( new HyperListener());
    //Create whiteboard
    dPanel = new DrawPanel();
    dPButton = new DrawPanel();
    dFonts = new DrawPanel();
    dControls = new DrawControls(dPanel);
    dButtons = new DrawButtons(dPButton);
         //JLable fontLab = new JLabel(fontLable);
    //fontLab.setText("Fonts");
    //Font newFont = getFont().deriveFont(1);
    //fontLab.setFont(newFont);
    //fontLab.setHorizontalAlignment(JLabel.CENTER);
    JPanel whiteboard = new JPanel();
    whiteboard.setLayout(new BorderLayout());
    whiteboard.setPreferredSize(new Dimension(300,300));
    whiteboard.add("Center",dPanel);
    whiteboard.add("South",dControls);
    whiteboard.add("North",dButtons);
         JScrollPane editorScrollPane = new JScrollPane(editorPane);
         editorScrollPane.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
         editorScrollPane.setPreferredSize(new Dimension(250, 145));
         editorScrollPane.setMinimumSize(new Dimension(50, 50));
    //put everything in a panel
         JPanel contentPane = new JPanel();
         JPanel fontPane = new JPanel();
         contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
    //add whiteboard
         contentPane.add(whiteboard);
    //add editor box
         contentPane.add(editorScrollPane);
    //add spacer
         contentPane.add(Box.createRigidArea(new Dimension(0,5)));
    //add textfield
         contentPane.add(textField);
    //set up layout pane
         //layoutPanel.add(GridLayout(2,1),fontLab);
         layoutPanel.add( BorderLayout.NORTH, fontlist);     
         layoutPanel.add(BorderLayout.WEST,new Label("Name: ")); //add a label
         layoutPanel.add(BorderLayout.CENTER, userName ); //add textfield for user names
         layoutPanel.add(BorderLayout.SOUTH, connectbutton);//add dropdown box for fonts
         //fontPane.add(BorderLayout.NORTH,fontlist);
         contentPane.add(layoutPanel);
         contentPane.add(controlPanel);
         contentPane.add(buttonPanel);
    //Create the menu bar.
    menuBar = new JMenuBar();
    setJMenuBar(menuBar);
    //Build the first menu.
         JMenu menu = new JMenu("File");
         menu.setMnemonic(KeyEvent.VK_F);
         menuBar.add(menu);
    //a group of JMenuItems
         JMenuItem menuItem = new JMenuItem("Load Graphic", KeyEvent.VK_L);
         menu.add(menuItem);
    menuItem.setActionCommand(loadgraphicString);
         menuItem.addActionListener(this);
    connectbutton.setActionCommand(connectString);
    connectbutton.addActionListener(this);
         setContentPane(contentPane);
    static private void insertTheHTML(JEditorPane editor, String html, int location) throws IOException {
         HTMLEditorKit kit = (HTMLEditorKit) editor.getEditorKit();
         Document doc = editor.getDocument();
         StringReader reader = new StringReader(html);
         try {
              kit.read(reader, doc, location);
         } catch (BadLocationException e) {}
    //listen for actions being performed and process them
    public void actionPerformed(ActionEvent e) {
    //if the action is from the textfield (e.g. user hits enter)
         if (e.getActionCommand().equals(textFieldString)) {
              JTextField fromUser = (JTextField)e.getSource();
         if (fromUser != null){
    //place user text in editor pane
    //send message to server
                   if (userName.getText() != null) {
                        userString = userName.getText().trim();
                   out.println(userString + ": " + fromUser.getText());
              fromUser.setText("");
         } else if(e.getActionCommand().equals(connectString)) {
              CONNECTFLAG = true;
    } else if (e.getActionCommand().equals(loadgraphicString) ) {
              final JFileChooser fc = new JFileChooser();
              int returnVal = fc.showOpenDialog(this);
              if (returnVal == JFileChooser.APPROVE_OPTION) {
                   File file = fc.getSelectedFile();
                   dPanel.loadImage(file.getAbsolutePath());
                   sendImage(file);
         else if (e.getActionCommand().equals(fontlist)){
         JComboBox cb = (JComboBox)e.getSource();
    String newSelection = (String)cb.getSelectedItem();
    currentFont = newSelection;
         userString = currentFont;
    return;
    /*public void itemStateChanged (ItemEvent e) {
    if ( e.getStateChange() != ItemEvent.SELECTED ) {
    return;
    if ( list == fontlist ) {
    fontchoice = (String)fontlist.getSelectedItem();
         userString.changeFont(fontchoice);
    //append text to the editor pane and put it at the bottom
    public static void appendText(String text) {
         if (text.startsWith("ID ") ) {
              userString = text.substring(3);
         } else if (text.startsWith("DRAW ") ) {
              if (text.regionMatches(5,"LINE",0,4)) {
    dPanel.processLine(text);
         }else if (text.regionMatches(5,"POINTS",0,5)) {
         dPanel.processPoint(text);
         } else if (text.startsWith("IMAGE ") ) {
    int len = (new Integer( text.substring(6, text.indexOf(",")))).intValue();
    //get x and y coordinates
         byte[] data = new byte[ (int)len ];
         int read = 0;
    try {
         while (read < len) {
         data = text.getBytes( text.substring(0, len) );
    } catch (Exception e) {}
         Image theImage = null;
         theImage = dPanel.getToolkit().createImage(data);
         dPanel.getToolkit().prepareImage(theImage, -1, -1, dPanel);
         while ((dPanel.getToolkit().checkImage(theImage, -1, -1, dPanel) & dPanel.ALLBITS) == 0) {}
              dPanel.drawPicture(0, 0, theImage);
    } else {
    //set current position in editorPane to the end
              editorPane.setCaretPosition(editorPane.getDocument().getLength());
    //put text into the editorPane
              try {
                   insertTheHTML(editorPane, text, editorPane.getDocument().getLength());
              } catch (IOException e) {}
    } //end of appendText(String)
    public void sendImage(File file) {
    //find length of file
         long len = file.length();
    //read file into byte array
         byte[] byteArray = new byte[(int)len];
         try {
              FileInputStream fstream = new FileInputStream(file);
              if (fstream.read(byteArray) < len) {
    //error could not load file
              } else {
              out.println("IMAGE " + len + ",");
                   out.write(byteArray, 0, (int)len); //write file to stream
         } catch(Exception e){}
    //run the client
    public static void main(String[] args) {
         String ipAddr=null, portNr=null;
              if (args.length != 2) {
                   System.out.println("USAGE: java guiClient IP_Address port_number");
                   System.exit(0);
              } else {
         ipAddr = args[0];
              portNr = args[1];
              JFrame frame = new guiClient();
              frame.addWindowListener(new WindowAdapter() {
                   public void windowClosing(WindowEvent e) { System.exit(0); }
              frame.pack();
              frame.setVisible(true);
              while(CONNECTFLAG == false){}
    //sames as previous client,
    //set up connection and then listen for messages from the Server
              String socketIP = ipAddr;
              int port = Integer.parseInt(portNr);
    //the IP address of the machine where the server is running
              Socket theSocket = null;
    //communication line to the server
              out = null;
    //for message sending
              BufferedReader in = null;
    //for message receiving
              try {
              theSocket = new Socket(socketIP, port );
    //try to connect
              out = new PrintStream(theSocket.getOutputStream());
                   dPanel.out = out;
    //for client to send messages
              in = new BufferedReader(new InputStreamReader(theSocket.getInputStream()));
                   BufferedReader userIn = new BufferedReader(new InputStreamReader(System.in));
                   String fromServer;
                   while ((fromServer = in.readLine()) != null) {
                   appendText(fromServer);
                   if (fromServer.equals("BYE")) {
                        appendText("Connection Closed");
                        break;
              out.close();
    //close all streams
              in.close();
              theSocket.close();
    //close the socket
         } catch (UnknownHostException e) {
    //if the socket cannot be openned
              System.err.println("Cannot find " + socketIP);
              System.exit(1);
              } catch (IOException e) { //if the socket cannot be read or written
              System.err.println("Could not make I/O connection with " + socketIP);
              System.exit(1);
    class HyperListener implements HyperlinkListener {
    public JEditorPane sourcePane;
    public void hyperlinkUpdate(HyperlinkEvent e) {
    if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
    sourcePane = (JEditorPane) e.getSource();
                   if (e instanceof HTMLFrameHyperlinkEvent) {
    HTMLFrameHyperlinkEvent event = (HTMLFrameHyperlinkEvent) e;
                        System.out.println(event.getTarget());
                        HTMLDocument doc = (HTMLDocument) sourcePane.getDocument();
                        doc.processHTMLFrameHyperlinkEvent(event);
    else {
    try {}
    catch (Exception ev){
         ev.printStackTrace();
    Well sorry the source code takes up the whole forum but I need a good feedback from this.

    All right...
    public class guiClient extends JFrame implements ActionListener {
    static String userString;
    static String currentFont;
    String fontchoice;
    String fontlist;
    static JTextField userName = new JTextField();
    public guiClient() {
         super("My Client");
    public guiClient() {
         super("My Client");
    // Create a ComboBox
    GraphicsEnvironment gEnv = GraphicsEnvironment.getLocalGraphicsEnvironment();
    String envfonts[] = gEnv.getAvailableFontFamilyNames();
    Vector vector = new Vector();
    for ( int i = 1; i < envfonts.length; i++ ) {
    vector.addElement(envfonts);
    JComboBox fontlist = new JComboBox (envfonts);
         fontlist.setSelectedIndex(0);
         fontlist.setEditable(true);
         fontlist.addActionListener(this);
         fontchoice = envfonts[0];     
    //Create a regular text field.
         JTextField textField = new JTextField(10);
         textField.setActionCommand(textFieldString);
         textField.addActionListener(this);
    public void actionPerformed(ActionEvent e) {
    //if the action is from the textfield (e.g. user hits enter)
         if (e.getActionCommand().equals(textFieldString)) {
              JTextField fromUser = (JTextField)e.getSource();
         if (fromUser != null){
    //place user text in editor pane
    //send message to server
                   if (userName.getText() != null) {
                        userString = userName.getText().trim();
                   out.println(userString + ": " + fromUser.getText());
              fromUser.setText("");
         else if (e.getActionCommand().equals(fontlist)){
         JComboBox cb = (JComboBox)e.getSource();
    String newSelection = (String)cb.getSelectedItem();
    currentFont = newSelection;
         userString = currentFont;
    return;

  • IWeb, HTML Snippet, and MySQL via GoDaddy (db already built)

    I have a site (zigcodes.info) that is hosted by GoDaddy. I built the site using iWeb. No complaints there. I have a MySQL database and table built to store codes added by users. There is also one called "hit list" on another page, but I haven't finished coding it. I need to solve this problem before I can finish that page. So far, I've successfully linked my submit forms to the database. When a user adds a code, it does indeed populate into the database (hooray for small miracles).
    Of course, doing this dumps the user onto a blank white page, but I think I can fix that with a redirect at the end of the php file used by the form. My problem comes in when I try to display the codes in the database on my page. I know how to query the db using SELECT * FROM, but I can't figure out what to do with the data after that.
    I'm having a heck of a time getting the HTML Snippet widget correct in iWeb. I've seen suggestions that are all over the place, but can't seem to get any to work. I'm told that <iframe> may be a viable solution, but I am at a loss as to how. Honestly, my site is very simple and I don't need fancy functionality. All I need is a list, in table form would be nice but really not necessary, of the 30 names/codes most recently added to the db by users of my site. I can get the echo command to print headers for my data, but not the data itself.
    Will <iframe> work, and if so, how? If not, what's my best bet? Should I go with a table in the HTML Snippet widget, with tags like  <? echo "$code"; ?> inserted into my<td></td> content? Or, would it be best to use the <script src="activecodes.php"></script> solution with an external php file? Or am I way off on all of these? I do know that iWeb won't do it for me with it's own magic, but it seems like there should still be a way to add code into the HTML Snippet widget and display the db data on the iWeb designed page. Help?

    Yeah, the code you suggested isn't live now because I always remove changes to my code that affect no change. It makes for a cleaner build later. Here are some variations of your sugestion that I tried:
    <div align="center"><form name="newcodes" action="newcode.php" method="post">
    <input type="text" name="newcode"/>
    <br />
    <input type="submit" value="Add it!" />
    <input type="hidden" name="good_url" value="http://www.zigcodes.info/" />
    </form>
    </div>
    AND
    <div align="center"><form name="newcodes" action="newcode.php" method="post">
    <input type="hidden" name="good_url" value="http://www.zigcodes.info/" />
    <input type="text" name="newcode"/>
    <br />
    <input type="submit" value="Add it!" />
    </form>
    </div>
    AND
    <div align="center"><form name="newcodes" action="newcode.php" method="post">
    <input type="text" name="newcode"/>
    <input type="hidden" name="good_url" value="http://www.zigcodes.info/" />
    <br />
    <input type="submit" value="Add it!" />
    </form>
    </div>
    I even tried this because I saw other people suggesting it in similar forums:
    <div align="center"><form name="newcodes" action="newcode.php" method="post">
    <input type="text" name="newcode"/>
    <br />
    <input type="submit" value="Add it!" />
    <input type="hidden" name="redirect" value="http://www.zigcodes.info/" />
    </form>
    </div>
    All of the above produce the exact same, unwanted result: a blank white screen with the URL of my .php file (the one that handles the form post).

Maybe you are looking for