WordPress.org

Forums

Picture search within site (5 posts)

  1. endeavor13
    Member
    Posted 1 year ago #

    Hi,

    I new to WordPress. I'm looking to create a way for our customers to search an image using an input field with the help of javascript.

    For example when they type the image name in the input field, the image will appear in an iframe from a folder on the server. There will be a folder of different images. We take pictures with Santa every year and would like for our customers to go to our website to view the picture and download a copy if they want. Is there a way to do this or any suggestions will really help?

    We have used this feature on our old website, which was basically all html. Now that we use a WordPress-based site, Its a bit of a challenge.
    How can i add this to my current wordpress site or is there a plugin for something like this?

    Thanks in advance,
    Endeavor

    Here is the javascript code:

    <script type="text/javascript">// <![CDATA[
    function loadFrame(el)
    {
    base = '.jpg';
    base2 = 'Christmas/';
    var f;
    var fName = el.form.target;
    if (fName && (f = window.frames) && (f = f[fName])){
    f.location = base2 + el.value + base;
    return false;
    }
    return true;
    }
    // ]]></script>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

  2. esmi
    Forum Moderator
    Posted 1 year ago #

    Have you reviewed Using_Javascript?

  3. endeavor13
    Member
    Posted 1 year ago #

    I tried it in the html view of the page that i want it on.

    It doesn't work, i'm not sure how to apply the javascript code within my wordpress page. Here is the full code i've been using:

    <p align="center"><iframe id="photo" align="middle" frameborder="1" height="555" marginheight="25" marginwidth="25" name="I1" src="http://www.webite.com/Christmas/4.jpg" width="390"></iframe></p>
     
    <p align="center"><strong>Enter Your Picture Code</strong> (Example: 2012-ABCDEF)</p>
    <script type="text/javascript">// <![CDATA[
    function loadFrame(el)
    {
    base = '.jpg';
    base2 = 'Christmas/';
    var f;
    var fName = el.form.target;
    if (fName && (f = window.frames) && (f = f[fName])){
    f.location = base2 + el.value + base;
    return false;
    }
    return true;
    }
    // ]]></script>
    
    <form action="" target="photo" onsubmit="return loadFrame(this.URL);">
    <p align="center"><input type="text" name="URL" size="25" />
    <em><span style="font-size: 12px;">(Internet Explorer Only)</span></em>
    For a full size photo type: large/2012-ABCDEF</p>
    <p align="center"><input class="buttonstyle" type="submit" value="Get my picture!" /></p>
    
    </form>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

  4. esmi
    Forum Moderator
    Posted 1 year ago #

  5. endeavor13
    Member
    Posted 1 year ago #

    Thanks esmi, however i'm not very familiar with php. I don't know how to apply my code the way suggested in the link you provided.

Topic Closed

This topic has been closed to new replies.

About this Topic