Results 1 to 3 of 3

Thread: alert function

  1. #1
    Join Date
    Apr 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default alert function

    Hi guys,

    This is kinda hard to explain but I will do my best.

    I am trying to create a javascript alert box which only alerts when there is data inside in the alert function. The information I want to display comes dynamically from the database. As such, when data is populated I want the alert to display. When there is no data in the alert function I dont want any alert box appearing. The way it works is the data comes in dynamicly through a placeholder @data@ I put in the javascript. Depending on the actions of the user this will populate with data or nothing at all. Below is an example of just a standad Alert with my plaeholder.

    Is there anyway I can do this? Any help would be greatly appreciated.

    <!--
    Code:
    <!--
    // Javascript Alert with placeholder
    
    alert ("@data@")
    //-->

  2. #2
    Join Date
    Nov 2006
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    how about a function

    function myalert(iVal){
    if (iVal) alert(iVal);
    }

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    I think your overall strategy is wrong. Have the server side database code create the function if it's needed. If it isn't, then don't have it there... it just messes things up.
    You could use comments, perhaps, if that would help...
    //function(), but doesn't go, 'cause of comments
    Just put // to disable a line, at the beginning of the line, with the server side code.
    But, again, just don't create the function in the first place.

    the above could help as well.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •